package com.demo.deal_service.model.entity;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

/***
 * 商品实体类
 */
public class Order {
	
	private Long oid;//主键id

    private String otime;//订单时间

    private int commodityid;//商品ID

   
    private int comamount;//商品数量

   
    private String merchantname;//商家名称

   
    private String merchantress;//商家地址

   
    private double ordertotal;//订单金额

   
    private String payment;//付款方式

   
    private String ostatus;//订单状态

   
    private String uname;//下单人

   
    private String address;//收货地址

    
    private String phone;//电话
    
	
    /**
	 * @return oid
	 */
	public Long getOid() {
		return oid;
	}

	/**
	 * @param oid 要设置的 oid
	 */
	public void setOid(Long oid) {
		this.oid = oid;
	}

	/**
	 * @return otime
	 */
	public String getOtime() {
		return otime;
	}

	/**
	 * @param otime 要设置的 otime
	 */
	public void setOtime(String otime) {
		this.otime = otime;
	}

	/**
	 * @return commodityid
	 */
	public int getCommodityid() {
		return commodityid;
	}

	/**
	 * @param commodityid 要设置的 commodityid
	 */
	public void setCommodityid(int commodityid) {
		this.commodityid = commodityid;
	}

	/**
	 * @return comamount
	 */
	public int getComamount() {
		return comamount;
	}

	/**
	 * @param comamount 要设置的 comamount
	 */
	public void setComamount(int comamount) {
		this.comamount = comamount;
	}

	/**
	 * @return merchantname
	 */
	public String getMerchantname() {
		return merchantname;
	}

	/**
	 * @param merchantname 要设置的 merchantname
	 */
	public void setMerchantname(String merchantname) {
		this.merchantname = merchantname;
	}

	/**
	 * @return merchantress
	 */
	public String getMerchantress() {
		return merchantress;
	}

	/**
	 * @param merchantress 要设置的 merchantress
	 */
	public void setMerchantress(String merchantress) {
		this.merchantress = merchantress;
	}

	/**
	 * @return ordertotal
	 */
	public double getOrdertotal() {
		return ordertotal;
	}

	/**
	 * @param ordertotal 要设置的 ordertotal
	 */
	public void setOrdertotal(double ordertotal) {
		this.ordertotal = ordertotal;
	}

	/**
	 * @return payment
	 */
	public String getPayment() {
		return payment;
	}

	/**
	 * @param payment 要设置的 payment
	 */
	public void setPayment(String payment) {
		this.payment = payment;
	}

	/**
	 * @return ostatus
	 */
	public String getOstatus() {
		return ostatus;
	}

	/**
	 * @param ostatus 要设置的 ostatus
	 */
	public void setOstatus(String ostatus) {
		this.ostatus = ostatus;
	}

	/**
	 * @return uname
	 */
	public String getUname() {
		return uname;
	}

	/**
	 * @param uname 要设置的 uname
	 */
	public void setUname(String uname) {
		this.uname = uname;
	}

	/**
	 * @return address
	 */
	public String getAddress() {
		return address;
	}

	/**
	 * @param address 要设置的 address
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * @return phone
	 */
	public String getPhone() {
		return phone;
	}

	/**
	 * @param phone 要设置的 phone
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	
	 /* （非 Javadoc）
		 * @see java.lang.Object#toString()
		 */
		@Override
		public String toString() {
			return "Order [oid=" + oid + ", otime=" + otime + ", commodityid=" + commodityid + ", comamount=" + comamount
					+ ", merchantname=" + merchantname + ", merchantress=" + merchantress + ", ordertotal=" + ordertotal
					+ ", payment=" + payment + ", ostatus=" + ostatus + ", uname=" + uname + ", address=" + address
					+ ", phone=" + phone + "]";
		}
	
    
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        Order order = (Order) o;

        return new EqualsBuilder()
                .append(getOtime(), order.getOtime())
                .append(getCommodityid(), order.getCommodityid())
                .append(getComamount(), order.getComamount())
                .append(getMerchantname(), order.getMerchantname())
                .append(getMerchantress(), order.getMerchantress())
                .append(getOrdertotal(), order.getOrdertotal())
                .append(getPayment(), order.getPayment())
                .append(getOstatus(), order.getOstatus())
                .append(getUname(), order.getUname())
                .append(getAddress(), order.getAddress())
                .append(getPhone(), order.getPhone())
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(getOtime())
                .append(getCommodityid())
                .append(getComamount())
                .append(getMerchantname())
                .append(getMerchantress())
                .append(getOrdertotal())
                .append(getPayment())
                .append(getOstatus())
                .append(getUname())
                .append(getAddress())
                .append(getPhone())
                .toHashCode();
    }
    
}

